﻿using System;
using System.Text;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
            Console.WriteLine("Please input the price of thde products!");
            Decimal price = Convert.ToDecimal(Console.ReadLine());
            Console.WriteLine("Please input the money you will pay!!");
            Decimal money = Convert.ToDecimal(Console.ReadLine());
            Decimal change = price- money;
            String[] amount = new String[8] { "100", "50", "20", "10", "5", "1", "0.5", "0.1" };
            Decimal[] num = new Decimal [8];

            if (change == 0)
            {
                Console.WriteLine("No change is needed!");
            }
            else
            {
                Decimal remianDollars=change;
                int value = 0;
                Console.Write("你一共找零{0}元,", change);
                for (int i=0;i<6;i++)
                {
                    value = Convert.ToInt32(amount[i]);
                    num[i] = (int)remianDollars / value;
                    remianDollars = remianDollars % value;
                }
                num[6] =(int) remianDollars / (decimal)0.5;
                remianDollars =(int)(( remianDollars % (decimal)0.5)*10);
                num[7] = remianDollars;
                for (int i=0;i<8;i++)
                {
                    Console.Write("{0}元{1}张 ,", amount[i], num[i]);
                }
                Console.ReadKey();


            }

        }
    }
}
